<template>
	<view class="content">
	    <view style="height: 30rpx;">
			
		</view>
		<view class="line_title">
			我的
		</view>
		<!-- 客户端+++++++++++++++++++++++++++++++++++++++++++++ -->
		<view v-if="kehu">
			<view style="height: 100rpx;"></view>
			<view class="clear">
				<view class="left" style="width: 50%;padding: 75rpx 0px 0px 8%;">
				   <view class="munber" style="font-size: 60rpx">{{total}}</view>
				   <view class="munber-name" style="margin-top: 10rpx;">总额度（元）</view>
				</view>
				<view class="left clear" style="width: 50%;">
					<view class="right"style="padding-right: 10%;">
						<view class="touxiang" @tap="gotouxiang()">
							<image :src="touxiang"></image>
						</view>
						<view class="line_title" style="font-weight: bold;">{{nickname}}</view>
					</view>
				</view>
			</view>
			<view style="height: 70rpx;"></view>
			<view class="mokuai clear geren" style="width: 90%; padding: 40rpx 20rpx;">
				<view class="left" @tap="gomyshenqing()" style="width: 50%;">
					<view>
						<image src="../../static/img/my-icon2.png"></image>
					</view>
					<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
						我的申请
					</view>
				</view>
				<view class="left" @tap="gorecode()" style="width: 50%;">
					<view>
						<image src="../../static/img/my-icon1.png"></image>
					</view>
					<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
						贷款记录
					</view>
				</view>
			</view>
		</view>
		<!-- 业务端+++++++++++++++++++++++++++++++++++++++++++++ -->
		<view v-if="yewu">
			<view style="height: 50rpx;"></view>
			<view>
				<view class="touxiang" @tap="gotouxiang()">
					<image :src="touxiang"></image>
				</view>
				<view class="line_title" style="font-weight: bold;">{{nickname}}</view>
			</view>
			<view style="height: 100rpx;"></view>
			<view class="mokuai clear geren" style="width: 90%; padding: 40rpx 20rpx;" v-if="user.top!=3">
				<view class="left" @tap="gokhlist()" style="width: 33.3%;">
					<view>
						<image src="../../static/img/icon1.png"></image>
						
					</view>
					<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
						客户管理
					</view>
				</view>
				<view class="left" @tap="goziliao()" style="width: 33.3%;">
					<view>
						<image src="../../static/img/icon2.png"></image>
						
					</view>
					<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
						客户资料审核
					</view>
				</view>
				<view class="left" @tap="goshenhe()" style="width: 33.3%;">
					<view>
						<image src="../../static/img/shenhe.png"></image>	
					</view>
					<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
						贷款审核
					</view>
				</view>
			</view>
		</view>
		
		
		
		
		
		<view class="mokuai clear geren" style="width: 90%; padding: 40rpx 20rpx;" v-if="user.top==3">
			<view class="left" @tap="gokhlist()" style="width: 50%;">
				<view>
					<image src="../../static/img/icon1.png"></image>
				</view>
				<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
					客户管理
				</view>
			</view>
			<view class="left"@tap="goshenhe()" style="width: 50%;">
				<view>
					<image src="../../static/img/shenhe.png"></image>
				</view>
				<view style="font-size: 28rpx;margin-top: 10rpx;color: #666666;">
					贷款审核
				</view>
			</view>
		</view>
		
		
		
		<view style="height: 100rpx;"></view>
		<view class="mokuai"  style="width: 90%;padding: 5px 15px;">
			<view class="clear btn_item" @tap="gomessage()">
				<image class="left" src="../../static/img/message.png"></image>
				<view class="btn_text left">消息中心</view>
			</view>
			<view class="clear btn_item" @tap="goset()">
				<image class="left" src="../../static/img/set.png"></image>
				<view class="btn_text left">账号设置</view>
			</view>
			<view class="clear btn_item" @tap="goabout()">
				<image class="left" src="../../static/img/about.png"></image>
				<view class="btn_text left">关于我们</view>
			</view>
			<view class="clear btn_item" @tap="goout()">
				<image class="left" src="../../static/img/out_icon.png"></image>
				<view class="btn_text left">退出账号</view>
			</view>
			
		</view>
		<view class="menban" v-show="isbohui">
			<view class="gray"></view>
				<view class="menban-content" style="top:calc(50% - 200rpx);left: 10%;right: 10%;border-radius:5px ;">
					<view class="line_title blue_title" style="position: relative;">
						资料驳回原因
						<image src="../../static/img/close-icon.png" class="close-icon" @tap="isalertAction"></image>
					</view>
					<view  class="text" style="padding: 0px 60rpx;">
						{{bohui_content}}
					</view>
					<button class="big_button" style="margin: 30rpx auto;" @tap="goet()">
						立即修改资料
					</button>
				</view>
		</view>	
		<view class="footer clear">
			<view class="left" @tap="goindex()">
				<view class="footer_icon">
					<image :src="icon"></image>
				</view>
				<text class="footer_text" >{{text}}</text>
			</view>
			<view class="left" >
				<view class="footer_icon">
					<image src="../../static/img/wode-active.png"></image>
				</view>
				<text class="footer_text" style="color: #1e99ff;">我的</text>
			</view>
		</view>
		<view style="height: 55px;"></view>
	</view>
</template>

<script>
	import httpPath from '@/static/js/path.js';
	import {getlogin} from '@/static/js/login.js';
	import {fmoney} from '@/static/js/login.js';
	export default {
		data() {
			return {
				kehu:false,//是否是客户端
				yewu:false,//是否是业务
				user:{},//用户登录信息
				total:"0.00",//总额度
				nickname:"昵称",
				touxiang:"../../static/img/touxiang.png",
				isbohui:false,
				bohui_content:"",
				icon:"../../static/img/daiban.png",
				text:"贷款",
				info:{},
			}
		},
		onShow(){
			this.user = getlogin();
			if(!this.user.islogin){
				// uni.showModal({
				//    showCancel:false,
				//    content:"您还没有登录，请登录"
				// })
				uni.navigateTo({
					url:"../public/login"
				})
			}
			if(this.user.type==1){
				this.getinfo();
				this.kehu = true;
				this.yewu = false;
				this.icon="../../static/img/dai.png"
				this.text="贷款"
				console.log("onshow"+this.user.is_check)
				// if(this.user.is_check==-1){
				// 	this.isbohui=true;
				// }else{
				// 	this.isbohui=false;
				// }
			}else if(this.user.type==2){
				this.yewu = true;
				this.kehu = false;
				this.text="待办"
				this.icon="../../static/img/daiban.png"
			}
			this.getinfo()
		},
		onLoad() {
			
			this.user = getlogin();
	        if(!this.user.islogin){
	        	uni.navigateTo({
	        		url:"../public/login"
	        	})
	        }
			if(this.user.type==1){
				this.getinfo();
				this.kehu = true;
				this.yewu = false;			
				this.icon="../../static/img/dai.png"
				this.text="贷款"
			}else if(this.user.type==2){
				this.yewu = true;
				this.kehu = false;
				this.text="待办"
				this.icon="../../static/img/daiban.png"
			}
			this.getinfo()
		},
		methods: {
			gomessage(){
				uni.navigateTo({
					url:"messagelist"
				})
			},
			goindex(){
				uni.navigateTo({
					url:"../index/index",
					animationType: 'none',
				})
			},
			isalertAction(){
				this.isbohui=false;
			},
			goet(){
				uni.navigateTo({
					url:"../public/edit_info"
				})
				},
			gotouxiang(){
				uni.navigateTo({
					url:"../public/touxiang"
				})
			},
			getinfo(){//获取客户端首页信息
				uni.request({
					url: httpPath.filePath+'/api.php/index/member/member_info/',
					method:'POST',
					header:{'content-type':'application/x-www-form-urlencoded'},
					data: {member_id:this.user.member_id},
					async: false,
					success: (res) => {
						if(res.data.code=="200"){
							this.info=res.data.result;
							if(res.data.result.headpic!=""&&res.data.result.headpic!=null){
								this.touxiang=res.data.result.headpic;
							}
							this.total=fmoney(res.data.result.capital,2)
							if(res.data.result.nickname!=null&&res.data.result.nickname!=""){
								this.nickname=res.data.result.nickname;
							}
							// console.log(res.data.result.is_check)
							if(res.data.result.is_check==-1){
								this.isbohui=true;
							}else{
								this.isbohui=false;
							}
							
							this.bohui_content=res.data.result.check_content
						}else{
							uni.showModal({
								content:res.data.message,
								showCancel:false
							})
						}
						   
					}
				});
				
			},
			// 点击跳转到审核页面
			goshenhe(){
			    uni.navigateTo({
			    	url:"./shenhe"
			    })   
			},// 点击跳转到审核页面
			goziliao(){
			    uni.navigateTo({
			    	url:"ziliao"
			    })
				   
			},// 点击跳转到审核页面
			gokhlist(){
			    uni.navigateTo({
			    	url:"kehulist"
			    })
				   
			},goabout(){
				uni.navigateTo({
					url:"../public/about"
				})
			},gomyshenqing(){
				uni.navigateTo({
					url:"../kehu/shenqinglist"
				})
			},goset(){
				uni.navigateTo({
					url:"../public/set"
				})
			},gorecode(){
				uni.navigateTo({
					url:"daikuanlist"
				})
			},goout(){
				uni.showModal({
					content:"确定要退出吗？",
					success: function (res) {
						if (res.confirm) {
							uni.removeStorage({
							    key: 'user',
							    success: function (res) {
							        uni.navigateTo({
							        	url:"../public/login"
							        })
							    }
							});
						}
					}
				})
				
			}
		}
	}
</script>

<style>
	@import "../../colorui/main.css";
	 page{background: url(../../static/img/back.jpg)no-repeat;background-size:cover;background-position: top;}
     .btn_item{border-bottom: 1px solid #edf1f9;height: 50px;}
	 .btn_item image{width: 20px;height: 20px;margin-top:15px;}
	 .btn_item:last-of-type{border: none;}
	 .btn_text{font-size: 30rpx;padding-left: 10px;width: 80%;line-height: 50px;color: #666666;}
	 .footer{height: 50px;position: fixed;bottom: 0px;left: 0px;width: 100%;box-shadow: -1px -1px 1px #dce0e7;display: flex;flex-direction: row;padding: 5px 0px;background: #fff;}
	  .footer .left{width: 50%;text-align: center;}
	  .footer_icon{width: 25px;height: 25px;margin: auto;}
	  .footer_icon image{width: 100%;height: 100%;}
	  .footer_text{font-size: 26rpx;color: #999999;}
</style>
